/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.ui.utils;

import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import pe.edu.unmsm.cinfo.siga.datos.Modulo;
import pe.edu.unmsm.cinfo.siga.datos.ProgramaModulo;

/**
 *
 * @author lartkma
 */
public class ModuloListCellRenderer extends DefaultListCellRenderer {

    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        if (value instanceof ProgramaModulo) {
            setText(((ProgramaModulo)value).getModulo().getModDesc());
        }else if(value instanceof Modulo){
            setText(((Modulo)value).getModDesc());
        }
        return this;
    }
    
}
